package com.dxx.cloud.admin.controller.toc;

import com.dxx.cloud.admin.constant.CommonConst;
import com.dxx.cloud.admin.module.entity.CustomerGiftCard;
import com.dxx.cloud.admin.service.ICustomerGiftCardService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @author dh
 */
@RestController
@RequestMapping(CommonConst.RouterPath.TOC + "/customerGiftCard")
@Tag(name = "礼品卡模块")
@Slf4j
public class TocCustomerGiftCardController {

    @Resource
    private ICustomerGiftCardService customerGiftCardService;


    @Operation(summary = "我的礼品卡列表")
    @PostMapping("/myCardList")
    public R<List<CustomerGiftCard>> myCardList() {
        return R.ok(customerGiftCardService.list());
    }

    @Operation(summary = "新增礼品卡")
    @PostMapping("/add")
    public R<Boolean> add(@RequestBody CustomerGiftCard request) {
        return R.ok(customerGiftCardService.save(request));
    }
}